<!--
 * @Author: yaojian66 1327629137@qq.com
 * @Date: 2022-07-05 16:24:20
 * @LastEditors: yaojian66 1327629137@qq.com
 * @LastEditTime: 2022-07-05 16:25:40
 * @FilePath: \geyao\第一百一十四题 dom节点查找.html
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>dom节点查找</title>
</head>

<body>
  <script>
    function commonParentNode(oNode1, oNode2) {
      let parent1 = oNode1.parentNode;
      let parent2 = oNode2.parentNode;
      if (parent1 === parent2) {
        return parent1
      } else {
        commonParentNode(parent1, parent2)
      }
    }
  </script>
</body>

</html>